<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@include file="/sunzbase.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>修改密码</title>
</head>
<body>
<div class="pd-20">
  <form class="Huiform" id="changeSelfPassword" method="post" action="">
    <table class="table">
      <tbody>
        <tr>
          <th width="100" class="text-r"><span class="c-red">*</span>旧密码：</th>
          <td><input type="password" style="width:200px" class="input-text" value="" id="oldPwd" name="oldPwd"></td>
        </tr>
        <tr>
        <tr>
          <th width="100" class="text-r"><span class="c-red">*</span>新密码：</th>
          <td><input type="password" style="width:200px" class="input-text" value="" id="newPwd" name="newPwd"><!-- <span class="c-red" id="newPasswordSpan" style="color:#151313">密码长度:6-15位</span> --></td>
        </tr>
        <tr>
          <th class="text-r"><span class="c-red">*</span> 确认密码：</th>
          <td><input type="password" style="width:200px" class="input-text" value="" id="confirmPwd" name="confirmPwd"><!-- <span class="c-red" id="confirmPasswordSpan"></span> --></td>
        </tr>
        <tr>
          <th></th>
          <td><button class="btn btn-success radius" type="submit" id="changeFormCommit"><i class="icon-ok"></i> 确定</button></td>
        </tr>
      </tbody>
    </table>
  </form>
</div>
<script type="text/javascript" src="http://cdn.bootcss.com/jquery/2.1.3/jquery.min.js"></script> 
<script type="text/javascript" src="resources/static/h-ui/js/H-ui.js"></script> 
<script type="text/javascript" src="resources/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="resources/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="resources/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="resources/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?080836300300be57b7f34f4b3e97d911";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F080836300300be57b7f34f4b3e97d911' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
$(function(){
	$("#changeSelfPassword").validate({
		rules:{
			oldPwd:{
				required:true,
			},
			newPwd:{
				required:true,
				isPwd:true,
			},
			confirmPwd:{
				required:true,
				isPwd:true,
				equalTo:"#newPwd",
			},
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$(form).ajaxSubmit({
				url:"${webRoot}/note/changePassword",
				data:$("#changeSelfPassword").serialize(),
				type:"POST",
				dataType:"json",
				success:function(result){
					if(result.success){
						layer.msg("密码修改成功,请重新登录",{icon:0});
						setTimeout(function(){
							window.parent.location.href="${webRoot}/note/login";
						}, 2000);
					}
				}
			});
		}
	});
});
</script>
</body>
</html>